<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>{html_select_time}</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="language.custom.functions.html" title="Chapter 8. Custom Functions">
<link rel="prev" href="language.function.html.select.date.html" title="{html_select_date}">
<link rel="next" href="language.function.html.table.html" title="{html_table}">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">{html_select_time}</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.function.html.select.date.html">Prev</a> </td>
<th width="60%" align="center">Chapter 8. Custom Functions</th>
<td width="20%" align="right"> <a accesskey="n" href="language.function.html.table.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="{html_select_time}">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.function.html.select.time"></a>{html_select_time}</h2></div></div></div>
<p>
   <code class="varname">{html_select_time}</code> is a
   <a class="link" href="language.custom.functions.html" title="Chapter 8. Custom Functions">custom function</a>
   that creates time dropdowns for you.
   It can display any or all of hour, minute, second and  meridian.
 </p>
<p>
  The <em class="parameter"><code>time</code></em> attribute can have different formats.
  It can be a unique timestamp, a  string of the format
  <code class="literal">YYYYMMDDHHMMSS</code> or a string  that is parseable by PHP's
  <a class="ulink" href="http://php.net/strtotime" target="_top"><code class="varname">strtotime()</code></a>.
 </p>
<div class="informaltable"><table border="1">
<colgroup>
<col align="center">
<col align="center">
<col align="center">
<col align="center">
<col>
</colgroup>
<thead><tr>
<th align="center">Attribute Name</th>
<th align="center">Type</th>
<th align="center">Required</th>
<th align="center">Default</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td align="center">prefix</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">Time_</td>
<td>What to prefix the var name with</td>
</tr>
<tr>
<td align="center">time</td>
<td align="center">
      <a class="ulink" href="http://php.net/function.time" target="_top">timestamp</a>, 
      <a class="ulink" href="http://php.net/class.DateTime" target="_top">DateTime</a>, 
      mysql timestamp or any string parsable by 
      <a class="ulink" href="http://php.net/strtotime" target="_top"><code class="varname">strtotime()</code></a>, 
      arrays as produced by this function if field_array is set.
     </td>
<td align="center">No</td>
<td align="center">current <a class="ulink" href="http://php.net/function.time" target="_top">timestamp</a>
</td>
<td>
      What date/time to pre-select. If an array is given, the attributes field_array and prefix 
      are used to identify the array elements to extract hour, minute, second and meridian from.
     </td>
</tr>
<tr>
<td align="center">display_hours</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><code class="constant">TRUE</code></td>
<td>Whether or not to display hours</td>
</tr>
<tr>
<td align="center">display_minutes</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><code class="constant">TRUE</code></td>
<td>Whether or not to display minutes</td>
</tr>
<tr>
<td align="center">display_seconds</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><code class="constant">TRUE</code></td>
<td>Whether or not to display seconds</td>
</tr>
<tr>
<td align="center">display_meridian</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><code class="constant">TRUE</code></td>
<td>Whether or not to display meridian (am/pm)</td>
</tr>
<tr>
<td align="center">use_24_hours</td>
<td align="center">boolean</td>
<td align="center">No</td>
<td align="center"><code class="constant">TRUE</code></td>
<td>Whether or not to use 24 hour clock</td>
</tr>
<tr>
<td align="center">minute_interval</td>
<td align="center">integer</td>
<td align="center">No</td>
<td align="center">1</td>
<td>Number interval in minute dropdown</td>
</tr>
<tr>
<td align="center">second_interval</td>
<td align="center">integer</td>
<td align="center">No</td>
<td align="center">1</td>
<td>Number interval in second dropdown</td>
</tr>
<tr>
<td align="center">hour_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%02d</td>
<td>What format the hour label should be in (sprintf)</td>
</tr>
<tr>
<td align="center">hour_value_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%20d</td>
<td>What format the hour value should be in (sprintf)</td>
</tr>
<tr>
<td align="center">minute_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%02d</td>
<td>What format the minute label should be in (sprintf)</td>
</tr>
<tr>
<td align="center">minute_value_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%20d</td>
<td>What format the minute value should be in (sprintf)</td>
</tr>
<tr>
<td align="center">second_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%02d</td>
<td>What format the second label should be in (sprintf)</td>
</tr>
<tr>
<td align="center">second_value_format</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">%20d</td>
<td>What format the second value should be in (sprintf)</td>
</tr>
<tr>
<td align="center">field_array</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">n/a</td>
<td>Outputs values to array of this name</td>
</tr>
<tr>
<td align="center">all_extra</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds extra attributes to select/input tags if given</td>
</tr>
<tr>
<td align="center">hour_extra</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds extra attributes to select/input tags if
      given</td>
</tr>
<tr>
<td align="center">minute_extra</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds extra attributes to select/input tags if
      given</td>
</tr>
<tr>
<td align="center">second_extra</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds extra attributes to select/input tags if
      given</td>
</tr>
<tr>
<td align="center">meridian_extra</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds extra attributes to select/input tags if
      given</td>
</tr>
<tr>
<td align="center">field_separator</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">\n</td>
<td>String printed between different fields</td>
</tr>
<tr>
<td align="center">option_separator</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">\n</td>
<td>String printed between different options of a field</td>
</tr>
<tr>
<td align="center">all_id</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds id-attribute to all select/input tags if given</td>
</tr>
<tr>
<td align="center">hour_id</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds id-attribute to select/input tags if given</td>
</tr>
<tr>
<td align="center">minute_id</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds id-attribute to select/input tags if given</td>
</tr>
<tr>
<td align="center">second_id</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds id-attribute to select/input tags if given</td>
</tr>
<tr>
<td align="center">meridian_id</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>Adds id-attribute to select/input tags if given</td>
</tr>
<tr>
<td align="center">all_empty</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>If supplied then the first element of any select-box has this
     value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the
     select-boxes read <span class="quote">“<span class="quote">Please select</span>”</span> for example.</td>
</tr>
<tr>
<td align="center">hour_empty</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>If supplied then the first element of the hour's select-box has this
     value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the
     select-box read <span class="quote">“<span class="quote">Please select an hour</span>”</span> for example.</td>
</tr>
<tr>
<td align="center">minute_empty</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>If supplied then the first element of the minute's select-box has this
     value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the
     select-box read <span class="quote">“<span class="quote">Please select an minute</span>”</span> for example.</td>
</tr>
<tr>
<td align="center">second_empty</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>If supplied then the first element of the second's select-box has this
     value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the
     select-box read <span class="quote">“<span class="quote">Please select an second</span>”</span> for example.</td>
</tr>
<tr>
<td align="center">meridian_empty</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">null</td>
<td>If supplied then the first element of the meridian's select-box has this
     value as it's label and <span class="quote">“<span class="quote"></span>”</span> as it's value. This is useful to make the
     select-box read <span class="quote">“<span class="quote">Please select an meridian</span>”</span> for example.</td>
</tr>
</tbody>
</table></div>
<div class="example">
<a name="id402197"></a><p class="title"><b>Example 8.18. {html_select_time}</b></p>
<div class="example-contents">
<pre class="programlisting">

{html_select_time use_24_hours=true}

  </pre>
<p>
   At 9:20 and 23 seconds in the morning the template above would output:
  </p>
<pre class="screen">

&lt;select name="Time_Hour"&gt;
&lt;option value="00"&gt;00&lt;/option&gt;
&lt;option value="01"&gt;01&lt;/option&gt;
... snipped ....
&lt;option value="08"&gt;08&lt;/option&gt;
&lt;option value="09" selected&gt;09&lt;/option&gt;
&lt;option value="10"&gt;10&lt;/option&gt;
... snipped ....
&lt;option value="22"&gt;22&lt;/option&gt;
&lt;option value="23"&gt;23&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Time_Minute"&gt;
&lt;option value="00"&gt;00&lt;/option&gt;
&lt;option value="01"&gt;01&lt;/option&gt;
... snipped ....
&lt;option value="19"&gt;19&lt;/option&gt;
&lt;option value="20" selected&gt;20&lt;/option&gt;
&lt;option value="21"&gt;21&lt;/option&gt;
... snipped ....
&lt;option value="58"&gt;58&lt;/option&gt;
&lt;option value="59"&gt;59&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Time_Second"&gt;
&lt;option value="00"&gt;00&lt;/option&gt;
&lt;option value="01"&gt;01&lt;/option&gt;
... snipped ....
&lt;option value="22"&gt;22&lt;/option&gt;
&lt;option value="23" selected&gt;23&lt;/option&gt;
&lt;option value="24"&gt;24&lt;/option&gt;
... snipped ....
&lt;option value="58"&gt;58&lt;/option&gt;
&lt;option value="59"&gt;59&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Time_Meridian"&gt;
&lt;option value="am" selected&gt;AM&lt;/option&gt;
&lt;option value="pm"&gt;PM&lt;/option&gt;
&lt;/select&gt;

  </pre>
</div>
</div>
<br class="example-break"><p>
    See also
    <a class="link" href="language.variables.smarty.html#language.variables.smarty.now" title="{$smarty.now}"><em class="parameter"><code>$smarty.now</code></em></a>,
    <a class="link" href="language.function.html.select.date.html" title="{html_select_date}"><code class="varname">{html_select_date}</code></a>
    and the <a class="link" href="tips.dates.html" title="Dates">date tips page</a>.
  </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.function.html.select.date.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.custom.functions.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.function.html.table.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">{html_select_date} </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> {html_table}</td>
</tr>
</table>
</div>
</body>
</html>
